package com.lagou.cl.util;

import java.util.concurrent.*;


public class TheadPoolUtil {

	public static ThreadPoolExecutor getThreadPoolExecutor() {

		//ThreadPoolExecutor(int corePoolSize,
		//                              int maximumPoolSize,
		//                              long keepAliveTime,
		//                              TimeUnit unit,
		//                              BlockingQueue<Runnable> workQueue,
		//                              ThreadFactory threadFactory,
		//                              RejectedExecutionHandler handler) {
		int corePoolSize = 10;
		int maximumPoolSize = 20000;
		long keepAliveTime = 20000L;
		TimeUnit minutes = TimeUnit.MINUTES;
		ArrayBlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(50);
		ThreadFactory threadFactory = Executors.defaultThreadFactory();
		ThreadPoolExecutor.AbortPolicy abortPolicy = new ThreadPoolExecutor.AbortPolicy();
		return new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, minutes, queue, threadFactory, abortPolicy);
	}
}
